#!/bin/bash
cd ${0%/*} || exit 1    # run from this directory
set -x

# Create a foam version header file
HEADERFOLDER=../inc/FoamDefs/$WM_PROJECT_VERSION
mkdir -p $HEADERFOLDER
HEADERPATH=$HEADERFOLDER/foam_defs.h
IFS='.' read -ra FOAM_VERSION <<< "$WM_PROJECT_VERSION"

if [ ! -f $HEADERPATH  ]
then
    touch $HEADERPATH
    echo "#define FOAM_MAJOR ${FOAM_VERSION[0]}" > $HEADERPATH
    echo "#define FOAM_MINOR ${FOAM_VERSION[1]}" >> $HEADERPATH
fi

(wmake libso fvDVM && wmake)

# ----------------------------------------------------------------- end-of-file
